import java.util.Scanner;

public class AllCommonDivisors {
    private static void CommonDivisors(long n, long m) {
        for (int i = 1; i <= Math.min(n, m); i++) {
            if (n % i == 0 && m % i == 0) {
                System.out.print(i + " ");
            }
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextInt();
        long b = scanner.nextInt();
        CommonDivisors(a, b);
    }
}
